﻿Public Class CJapanWordDetail
    Dim _ID As String
    Public Property ID() As String
        Set(ByVal value As String)
            _ID = value
        End Set
        Get
            Return _ID
        End Get
    End Property

    Public Sub LoadData(ByVal strId As String)
        Dim rs As ADODB.Recordset
        rs = ct.GetTable("select * from XSCWORD where id=" + strId)
        If rs IsNot Nothing Then
            If rs.State = ADODB.ObjectStateEnum.adStateOpen Then
                If Not (rs.EOF) Then
                    lblJAPANWORD.Text = CmnToStr(rs.Fields("JAPANWORD").Value)
                    lblCHINESEPLANT.Text = CmnToStr(rs.Fields("JAPANPLANT").Value)
                    lblJAPANPLANT.Text = CmnToStr(rs.Fields("CHINESEPLANT").Value)
                    lblJAPANJUZHI.Text = CmnToStr(rs.Fields("JAPANJUZHI").Value)
                    lblCHINAJUZHI.Text = CmnToStr(rs.Fields("CHINAJUZHI").Value)
                End If
                rs.Close()
                System.Runtime.InteropServices.Marshal.ReleaseComObject(rs) '20100531
                Exit Sub
            End If
            rs.Close()
            System.Runtime.InteropServices.Marshal.ReleaseComObject(rs) '20100531
        End If
        rs = Nothing
    End Sub

    Private Sub CJapanWordDetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadData(ID)
    End Sub

#Region "更新记录 A-2009-08-24"
    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
        Dim strSql As String = "select ID,JAPANWORD from XSCWORD Where ID='" + Me.ID + "'"
        Dim strSql1 As String = "select count(*) as PageCount from XSCWORD  Where ID='" + Me.ID + "'"
        Dim frm As New CListWord
        frm.iType = Me.iType
        frm.strName = Me.strName
        frm.iListToUpdate = 0
        frm.LoadListToUpdate(strSql, strSql1)
        frm.ShowDialog()
        LoadData(ID)
        frm.Dispose()
        frm = Nothing
    End Sub
#End Region

#Region "增加算法 查询的单词 要最前面显示 A-2009-09-26"
    Private Sub CWordDetail_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Try
            Dim cmd As New ADODB.Command
            cmd.CommandText = "Update XSCWORD set OPTIME=? where id=?"
            Dim pa As ADODB.Parameter = cmd.CreateParameter(, ADODB.DataTypeEnum.adDBTimeStamp, ADODB.ParameterDirectionEnum.adParamInput, -1, DateTime.Now.ToString())
            cmd.Parameters.Append(pa)
            pa = cmd.CreateParameter(, ADODB.DataTypeEnum.adVarWChar, ADODB.ParameterDirectionEnum.adParamInput, ID.Length, ID)
            cmd.Parameters.Append(pa)
            ct.ExcCommand(cmd)
        Catch ex As Exception
        End Try
    End Sub
#End Region
End Class
